﻿using System;
using System.Collections.Generic;
using System.Text;
using UmlDesigner.Gui;

namespace UmlDesigner.Model.WorkUnits
{
    class NewItemWorkUnit : IWorkUnit
    {
        public NewItemWorkUnit(ItemWidget addedItem)
        {
            item = addedItem;
        }

        private ItemWidget item = null;

        #region IWorkUnit Members

        public void Do(UmlControl umlControl)
        {
            umlControl.currentDocument.items.Add(item);
            umlControl.currentDocument.isModified = true;
            umlControl.Invalidate();
        }

        public void Undo(UmlControl umlControl)
        {
            umlControl.currentDocument.items.Remove(item);
            umlControl.currentDocument.isModified = true;
            umlControl.Invalidate();
        }

        #endregion
    }
}
